package com.gzu.ltms.controller.user;


import com.gzu.ltms.entity.vo.SendVerificationCodeReqVO;
import com.gzu.ltms.response.Response;
import com.gzu.ltms.service.VerificationCodeService;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/verificationCode")
public class VerificationCodeController {
    @Resource
    private VerificationCodeService verificationCodeService;


    /**
     * 获取邮件验证码
     * @return
     */
    @PostMapping("/mail")
    public Response<?> sendVerificationCodeMail(@Validated @RequestBody String email) {
        return verificationCodeService.email(email);
    }

    /**
     * 获取短信验证码
     * @return
     */
    @PostMapping("/phone")
    public Response<?> sendVerificationCodePhone(@RequestBody SendVerificationCodeReqVO sendVerificationCodeReqVO) {
        return verificationCodeService.send(sendVerificationCodeReqVO);
    }



}
